<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2016/10/8
 * Time: 22:40
 */
header('Content:text/html;charset=utf-8');
?>
<html>
<head>
    <style>
        p{ width:100%;hight:300px;font-size: 30px;margin-left: 100px;}
    </style>
</head>
<body>
<div>
    <p><h1 align="center">获取文件后缀</h1></p>
<?php
function getFileExt($path){$ext=substr($path,strrpos($path,'.')+1);
return $ext;}
$path='C:\images\yingbao.jpg';
$ext=getFileExt($path);
echo "<p>文件路径:$path</p>";
echo"<p>文件后缀:$ext</p>";
?>
    </div>
</body>
</html>
